package com.hxit.huaxiamelongarden.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hxit.huaxiamelongarden.domin.po.Content;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ContentMapper extends BaseMapper<Content> {
    //根据用户id查询所有内容
    public List<Content> getCommentsByUserId(int userId);
    //根据contentId查询内容
    public default Content getCommentsByContentId(int contentId){
        LambdaQueryWrapper<Content> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Content::getContentId,contentId);
        return selectOne(queryWrapper);
    }

    //根据标签id查询内容
    List<Content> findTagByIds(@Param("tagIds") List<Integer> tagIds);
}
